<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Editor.ascx.cs" Inherits="NCS.Module.CMS.Admin.UserControls.Editor" %>
<%@ Register Assembly="RadEditor.Net2" Namespace="Telerik.WebControls" TagPrefix="rade" %>

<rade:RadEditor id="txtContent" runat="server" configfile="\RadControls\Editor\ConfigFile.xml"
	DocumentsFilters="*.doc,*.pdf,*.zip,*.rar,*.xls,*.vsd,*.ppt,*.jpeg,*.wma,*.wmv" Editable="True" EnableDocking="False"
	 SaveInFile="False" stripabsoluteimagespaths="False"
	toolsfile="\RadControls\Editor\ToolsFile.xml" ToolsHeight="80px" toolswidth=" "
	UseClassicDialogs="True" CssFiles="~/Style/HomePage/Default.css" Width="100%"  CookieExpirationTime="3000" ShowSubmitCancelButtons="false" MediaFilters="*.asf,*.asx,*.wm,*.wmx,*.wmp,*.wma,*.wax,*.wmv,*.wvx,*.avi,*.wav,*.mpeg,*.mpg,*.mpe,*.mov,*.m1v,*.mp2,*.mpv2,*.mp2v,*.mpa,*.mp3,*.m3u,*.mid,*.midi,*.rm,*.rma,*.rmi,*.rmv,*.aif,*.aifc,*.aiff,*.au,*.snd, *.wmv, *.flv" MaxMediaSize="224288000" Skin="Default2006" CausesValidation="False" BackColor="White">
</rade:RadEditor>

 <script type="text/javascript">
 
// alert(RadEditorCommandList["FindAndReplace"]);
 
RadEditorCommandList["InsertRelateNewsLink"] = function(commandName, editor, args)
{
   /* var mk = '';
    for(var m in editor)
        mk += m + ', ';
    alert(mk);*/

//  var elem = editor.GetSelectedElement(); //returns the selected element.
//        
//  if (elem.tagName == "A")
//  {
//       editor.selectElement(elem);
//       argument = elem;
//  }
//  else
//  {
//     var content = editor.GetSelectionHtml();
//     var link = editor.GetDocument().createElement("A");
//     link.innerHTML = content;
//     argument = link;
//  }
 
  var myCallbackInsertRelateNewsLinkFunction = function(sender, args)
  {
        editor.PasteHtml(sender.relatenews);
  }
  
  //function (_1d, _1e, _1f) {
  var obj = {relatenews: 1};
  editor.ShowDialog(editor.GetDialogUrl(commandName), obj, 400, 300, myCallbackInsertRelateNewsLinkFunction, null, editor.Localization[commandName]);
  return false;
};

RadEditorCommandList["InsertRelateDocumentLink"] = function(commandName, editor, args)
{
  var myCallbackInsertRelateDocumentLinkFunction = function(sender, args)
  {
        editor.PasteHtml('<a href="'+ sender.file +'">'+ sender.title +'</a>');
  }
  
  //function (_1d, _1e, _1f) {
  var obj = {relatedoc: 1};
  editor.ShowDialog(editor.GetDialogUrl(commandName), obj, 400, 300, myCallbackInsertRelateDocumentLinkFunction, null, editor.Localization[commandName]);
  return false;
};
</script> 